'''
Created on 11-Jul-09

@author: jm
'''
import model 

class Locale(object): # db.Model ?
    '''
    (lang, country, variant).
    '''
     
    ENGLISH = model.Locale("en","","")
    FRENCH = model.Locale("fr","","")
    GERMAN = model.Locale("de","","")
    JAPANESE = model.Locale("ja","","")
    CHINESE = model.Locale("zh","","")
    SIMPLIFIED_CHINESE = model.Locale("zh","CN","")
    TRADITIONAL_CHINESE = model.Locale("zh","TW","")
    FRANCE = model.Locale("fr","FR","")
    GERMANY = model.Locale("de","DE","")
    JAPAN = model.Locale("ja","JP","")
    CHINA = model.Locale("zh","CN","")
    UK = model.Locale("en","GB","")
    US = model.Locale("en","US","")
    CANADA = model.Locale("en","CA","")
    CANADA_FRENCH = model.Locale("fr","CA","")

    defaultLocale = Locale.ENGLISH


    def __init__(self, language, country="", variant=""):
        '''
        Constructor
        '''
        self.language = language.lower()
        self.country = country.upper()
        self.variant = variant
        self.shortName = self.language
        if self.country.length() != 0: self.shortName = self.shortName + "_" + self.country
        if self.variant.length() != 0: self.shortName = self.shortName + "_" + self.variant
   
    def  getDefault(self):
        return self.defaultLocale 

    def setDefault(self, newLocale):
        self.defaultLocale = newLocale

